/**
 * @copyright Copyright (c) 2023..
 *
 * @file    dc_util.h
 * @brief   描述 通用API模块
 * @author  HC(202206728@any3.com)
 * @version 1.0
 * @date    2023-09-27
 */
#ifndef UTIL_H
#define UTIL_H

#include <string>
#include <vector>
#include <queue>

namespace DcAdr
{
    class Util
    {
        enum Type
        {
            E_InfoFileName,
            E_InfoFileType,
            E_InfoLastModifyTime,
            E_InfoTotalSize,
            E_InfoFilePath
        };

    public:
        //字符串替换
        static std::string stringReplace(const std::string &source, const std::string &oldValue, const std::string &newValue);
        static std::string deletSDAHead(const std::string &source);
        //获取当前ms时间
        static double getMsTime();

        //通过路径获取文件大小
        static std::string getFileSize(const std::string &fileName);
        //通过路径获取文件名
        static std::string getFileBaseName(const std::string &fileName);
        static std::string getFilePath(const std::string &filePathName);
        //拆分字符串
        static std::queue<std::string> split(const std::string &str, const std::string &pattern);
        static std::vector<std::string> split_vec(const std::string &str, const std::string &pattern);
        //获取路径下所有文件
        static std::vector<std::string> getFilesByDir(const std::string &strCurrentDir);

        static void uint64ToUint8(const uint64_t &src, uint8_t *des);
        static void uint32ToUint8(const uint32_t &src, uint8_t *des);

        static void uint8ToBinary(const uint8_t &src, char *des);

        static std::string queueToString(const std::queue<std::string> &queue);
    };
}
#endif // UTIL_H